package mspbots.hubspot.client.core.app;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Mono;

/**
 * mspbots.data.mspbots.data.hubspot.core.app.AutoTaskController
 *
 * @author Alex bob(https://github.com/vnobo)
 * @date Created by 2020/7/8
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("client/{tenantId}")
public class HubSpotController {

    private final HubSpotService hubSpotService;

    @PostMapping("test")
    public Mono<Boolean> testClient(@PathVariable Long tenantId) {
        return hubSpotService.testClient(tenantId);
    }

    @GetMapping("synchronise")
    public Mono<Boolean> synchronise(@PathVariable Long tenantId) {
        return hubSpotService.synchronise(tenantId);
    }

    @GetMapping("on-off/{onOff}")
    public Mono<Boolean> onOff(@PathVariable Long tenantId, @PathVariable String onOff) {
        return hubSpotService.onOffTenant(tenantId, onOff);
    }
}
